<template>
	<view class="all-view">
		<myLoading></myLoading>
		<view class="tab-view">
			<view class="tab-view-box">
				<view :class="current == 1 ? 'tab-view-item tab-view-active':'tab-view-item'" @click="onClickItem(1)">已核销</view>
				<view :class="current == 0 ? 'tab-view-item tab-view-active': 'tab-view-item'" @click="onClickItem(0)">未核销</view>
			</view>
		</view>
		<view v-if="userLength == 0" class="have-none-view">
			<image class="none-image" src="https://image.nanjingtouyang.com/touy/2023/11/2023110815213965869.png" mode=""></image>
			<view class="have-none-text">暂时还没有核销呢～</view>
		</view>
		<view v-else>
			<!-- 已核销 -->
			<view class="list-view" v-if="current=='Y'">
				<view class="list-title">
					<view class="list-title-name">昵称</view>
					<view class="list-title-phone">手机号</view>
					<view class="list-title-time">核销时间</view>
				</view>
				
				<view class="list-texts" v-for="(item, index) in userList" :key="index">
					<view class="list-title-name">{{ item.userName }}</view>
					<view class="list-title-phone">{{ item.phone }}</view>
					<view class="list-title-time">{{ item.verifyTime.slice(0,16) }}</view>
				</view>
			</view>
			
			<!-- 未核销-->
			<view class="list-view" v-else>
				<view class="list-title list-title-none">
					<view class="list-title-name">昵称</view>
					<view class="list-title-phone">手机号</view>
				</view>
				
				<view class="list-texts list-title-none" v-for="(item, index) in userList" :key="index">
					<view class="list-title-name">{{ item.userName }}</view>
					<view class="list-title-phone">{{ item.userPhone }}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { spVerifyOrdList } from "@/api/mine.js"
	export default {
		data(){
			return{
				current: 1,
				aptId: '',
				userList: [],
				userLength: 0,
				checkType: ''
				// checkList: ''
			}
		},
		onLoad(option){
			this.aptId = option.id
			this.checkType = option.checkType
			this.getList(this.current)
		},
		methods: {
			onClickItem(type){
				this.current = type
				this.userLength = 0
				this.getList()
				
			},
			getList() {
				spVerifyOrdList({
					pageNum: 1,
					pageSize: 10,
					aptId: this.aptId,
					qryType: this.current
				}).then(res => {
					this.userList = res.data.data
					this.userLength = this.userList.length
				})
			}
		},
	}
</script>

<style lang="scss">
	page {
		background-color: #FAFAFA;
	}
	.all-view {
		padding: 30rpx 30rpx 30rpx 30rpx;
		box-sizing: border-box;
	}
	.tab-view {
		width: 100%;
		.tab-view-box {
			width: 100%;
			height: 70rpx;
			border-radius: 35rpx;
			background-color: #fff;
			display: flex;
			justify-content: space-between;
			overflow: hidden;
			.tab-view-item {
				width: 50%;
				height: 100%;
				text-align: center;
				line-height: 70rpx;
				font-size: 28rpx;
				font-weight: 400;
				color: #333333;
			}
			.tab-view-active {
				background-color: #F0F0F0;
				color: #46973B;
			}
		}
	}
	.list-view {
		width: 100%;
		padding: 40rpx 0rpx 40rpx 0rpx;
		box-sizing: border-box;
		
		.list-title {
			width: 100%;
			display: flex;
			justify-content: space-between;
			font-size: 30rpx;
			font-weight: 500;
			color: #000000;
			.list-title-name {
				width: 208rpx;
				text-align: center;
				
			}
			.list-title-phone {
				width: 182rpx;
				text-align: center;
				
				
			}
			.list-title-time {
				width: 248rpx;
				text-align: center;
				
			}
		}
		.list-texts {
			width: 100%;
			display: flex;
			justify-content: space-between;
			font-size: 26rpx;
			font-weight: 400;
			color: #000000;
			margin-top: 20rpx;
			.list-title-name {
				width: 208rpx;
				text-align: center;
				overflow: hidden;
				white-space: nowrap;
				text-overflow: ellipsis;
			}
			.list-title-phone {
				width: 182rpx;
				text-align: center;
				overflow: hidden;
				white-space: nowrap;
				text-overflow: ellipsis;
			}
			.list-title-time {
				width: 248rpx;
				text-align: center;
				overflow: hidden;
				white-space: nowrap;
				text-overflow: ellipsis;
				
			}
		}
		.list-title-none{
			.list-title-name {
				width: 330rpx;
				text-align: center;
				overflow: hidden;
				white-space: nowrap;
				text-overflow: ellipsis;
			}
			.list-title-phone {
				width: 330rpx;
				text-align: center;
				overflow: hidden;
				white-space: nowrap;
				text-overflow: ellipsis;
			}
		}
	}
	.have-none-view {
		 width: 100%;
		 height: 100vh;
		 text-align: center;
		 .none-image {
			 width: 290rpx;
			 height: 282rpx;
			 margin-top: 150rpx;
			 
		 }
		 .have-none-text {
			 font-size: 24rpx;
			 margin-top: 30rpx;
			 font-weight: 400;
			 color: #ADADAD;
		 }
	}
</style>